#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

void solve(){
    int n;
    cin>>n;
    vector<ll> a(n+1);
    vector<ll> pre(n+2,0);
    for(int i=1;i<=n;i++){
    	cin>>a[i];
    	pre[i+1]=pre[i]+a[i];
    }
    for(int i=2;i<=n-1;i++){
    	for(int j=i+1;j<=n;j++){
    		ll s1=pre[i]%3;
    		ll s2=(pre[j]-pre[i])%3;
    		ll s3=(pre[n+1]-pre[j])%3;
    		// cout<<s1<<' '<<s2<<' '<<s3<<'\n';
    		// cout<<pre[3]<<' '<<pre[2]<<'\n';
    		if(s1!=s2&&s1!=s3&&s2!=s3){
    			cout<<i-1<<' '<<j-1<<'\n';
    			return;
    		}
    		if(s1==s2&&s2==s3){
    			cout<<i-1<<' '<<j-1<<'\n';
    			return;
    		}
    	}
    }
    cout<<0<<' '<<0<<'\n';
}

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0),cout.tie(0);
    int t=1;
    cin>>t;
    while(t--){
        solve();
    }
    return 0;
}